import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class UseStatement{
    public static void main(String[] args){
        try{
            // 加载Driver类
            Class.forName("com.mysql.jdbc.Driver");
            
            // 连接数据库
            String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
            String username = "root";
            String password = "";
            Connection conn = DriverManager.getConnection(url, username, password);
            
            // 由conn的createStatement()方法获取Statement
            Statement stmt = conn.createStatement();
            
            // 创建sql语句
            String sql = "create table fuck ( id int primary key auto_increment, fuck varchar(20) ) charset = utf8";
            stmt.executeUpdate(sql);
            
            //不使用时要close()
            stmt.close();
            conn.close();
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}